<template>
  <div>
    <van-nav-bar
      :title="title"
      :fixed="true"
      :placeholder="true"
      :z-index="2"
      @click-left="onClickLeft">
      <template #left>
        <van-icon
          v-if="leftArrow"
          name="arrow-left" />
      </template>
    </van-nav-bar>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "",
    },
    leftArrow: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {};
  },
  methods: {
    onClickLeft() {
      this.$emit("onClickLeft");
      console.log("0429-onClickLeft");
    },
  },

  // 解决在微信小程序中 样式穿透无效的问题
  options: {
    styleIsolation: "shared",
  },
};
</script>

<style lang="scss" scoped>
::v-deep .van-nav-bar {
  background-color: #40a0ff !important;
}
::v-deep .van-nav-bar__title {
  color: #fff !important;
  font-weight: bolder;
}
</style>
